<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Build text snippets</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="sphinxclient.addquery.html">SphinxClient::addQuery</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="sphinxclient.buildkeywords.html">SphinxClient::buildKeywords</a></div>
 <div class="up"><a href="class.sphinxclient.html">SphinxClient</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="sphinxclient.buildexcerpts" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SphinxClient::buildExcerpts</h1>
  <p class="verinfo">(PECL sphinx &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">SphinxClient::buildExcerpts</span> &mdash; <span class="dc-title">Build text snippets</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-sphinxclient.buildexcerpts-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><strong>SphinxClient::buildExcerpts</strong></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$docs</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$index</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$words</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$opts</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Connects to searchd, requests it to generate excerpts (snippets) from the
   given documents, and returns the results.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-sphinxclient.buildexcerpts-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">docs</code></em></dt>

     <dd>

      <p class="para">
       Array of strings with documents&#039; contents.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">index</code></em></dt>

     <dd>

      <p class="para">
       Index name.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">words</code></em></dt>

     <dd>

      <p class="para">
       Keywords to highlight.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">opts</code></em></dt>

     <dd>

      <p class="para">
       Associative array of additional highlighting options (see below).
      </p>
     </dd>

    
   </dl>


   <table class="doctable table">
    <caption><strong>Highlighting options</strong></caption>
    
     <thead>
      <tr>
       <th>Option</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>&quot;before_match&quot;</td>
       <td>A string to insert before a keyword match. Default is &quot;&lt;b&gt;&quot;.</td>
      </tr>

      <tr>
       <td>&quot;after_match&quot;</td>
       <td>A string to insert after a keyword match. Default is &quot;&lt;/b&gt;&quot;.</td>
      </tr>

      <tr>
       <td>&quot;chunk_separator&quot;</td>
       <td>A string to insert between snippet chunks (passages). Default is &quot; ... &quot;.</td>
      </tr>

      <tr>
       <td>&quot;limit&quot;</td>
       <td>Maximum snippet size, in symbols (codepoints). Integer, default is 256.</td>
      </tr>

      <tr>
       <td>&quot;around&quot;</td>
       <td>How much words to pick around each matching keywords block. Integer, default is 5.</td>
      </tr>

      <tr>
       <td>&quot;exact_phrase&quot;</td>
       <td>Whether to highlight exact query phrase matches only instead of
        individual keywords. Boolean, default is <strong><code>FALSE</code></strong>.</td>
      </tr>

      <tr>
       <td>&quot;single_passage&quot;</td>
       <td>Whether to extract single best passage only. Boolean, default is <strong><code>FALSE</code></strong>.</td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-sphinxclient.buildexcerpts-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns array of snippets on success 或者在失败时返回 <strong><code>FALSE</code></strong>.
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="sphinxclient.addquery.html">SphinxClient::addQuery</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="sphinxclient.buildkeywords.html">SphinxClient::buildKeywords</a></div>
 <div class="up"><a href="class.sphinxclient.html">SphinxClient</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
